package com.example.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.web.servlet.config.annotation.*;

@Configuration
public class WebMvcConfigTest implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //日志拦截器
        registry.addInterceptor(new TdLogInterceptor()).addPathPatterns("/**");

        //交易拦截器
        registry.addInterceptor(new CommInterceptor()).addPathPatterns("/**");
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry){
        //默认页面设置为user.jsp
        registry.addViewController("/").setViewName("user");
    }
}
